load("//bazel:mongo_src_rules.bzl", "mongo_cc_benchmark", "mongo_cc_library", "mongo_cc_unit_test")

package(default_visibility = ["//visibility:public"])

exports_files(
    glob([
        "*.h",
        "*.cpp",
    ]),
)

mongo_cc_library(
    name = "query_metadata",
    srcs = [
        "index_entry.cpp",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:query_expressions",
    ],
)

mongo_cc_unit_test(
    name = "query_metadata_test",
    srcs = [
        "index_entry_test.cpp",
    ],
    tags = ["mongo_unittest_second_group"],
    deps = [
        ":query_metadata",
    ],
)

mongo_cc_library(
    name = "path_arrayness",
    srcs = [
        "path_arrayness.cpp",
    ],
    hdrs = [
        "path_arrayness.h",
    ],
    deps = [
        "//src/mongo:base",
        "//src/mongo/db:common",
        "//src/mongo/db/commands/server_status:server_status_core",
        "//src/mongo/db/pipeline:field_path",
    ],
)

mongo_cc_library(
    name = "path_arrayness_test_helpers",
    srcs = [
        "path_arrayness_test_helpers.cpp",
    ],
    hdrs = [
        "path_arrayness_test_helpers.h",
    ],
    deps = [
        ":path_arrayness",
        "//src/mongo/db/query/compiler/ce:ce_test_utils",
    ],
)

mongo_cc_unit_test(
    name = "path_arrayness_test",
    srcs = [
        "path_arrayness_test.cpp",
    ],
    tags = ["mongo_unittest_first_group"],
    deps = [
        ":path_arrayness",
        ":path_arrayness_test_helpers",
        "//src/mongo/db/index:index_access_method",
    ],
)

mongo_cc_benchmark(
    name = "path_arrayness_bm",
    srcs = ["path_arrayness_bm.cpp"],
    tags = ["second_half_bm"],
    deps = [
        ":path_arrayness",
        ":path_arrayness_test_helpers",
        "//src/mongo/db/query:query_test_service_context",
    ],
)
